home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 351-375 / 359 / dice / dice.lzh / lib / string / strncat.c < prev    next >
C/C++ Source or Header  |  1990-03-27  |  395b  |  38 lines

  1.  
  2. /*
  3.  *  STRNCAT.C
  4.  *
  5.  *  (c)Copyright 1990, Matthew Dillon, All Rights Reserved
  6.  */
  7.  
  8. #include <string.h>
  9.  
  10. typedef unsigned char ubyte;
  11.  
  12. char *
  13. strncat(d, s, n)
  14. char *d;
  15. const char *s;
  16. int n;
  17. {
  18.     char c;
  19.     char *base= d;
  20.  
  21.     s;
  22.     n;
  23.  
  24.     if (n) {
  25.     d += strlen(d);
  26.     while (c = *s) {
  27.         *d = c;
  28.         ++s;
  29.         ++d;
  30.         if (--n == 0)
  31.         return(base);
  32.     }
  33.     *d = 0;
  34.     }
  35.     return(base);
  36. }
  37.  
  38.